#!/bin/bash

echo "正在执行一键 Git 同步..."

echo "1. 获取远程更新..."
git fetch origin

echo "2. 检查本地更改..."
git status

echo "3. 添加所有更改..."
git add .

echo "4. 提交更改..."
read -p "请输入提交信息（直接回车使用默认消息）: " commit_message
if [ -z "$commit_message" ]; then
    git commit -m "自动同步更新"
else
    git commit -m "$commit_message"
fi

echo "5. 推送到远程仓库..."
git push origin master

echo "一键 Git 同步完成！" 